import React, { Component, Suspense } from 'react';
import { HashRouter, BrowserRouter, Switch, Route } from "react-router-dom";

import HOCRouter from '@/pages/HOCRouter.js'

import NotFound from '@/pages/NotFound.js'


class App extends Component {
  constructor(props) {
    super(props);
  }
  render() {
    return (
      <HashRouter>
        <Switch>
          //render函数里的params参数是路由的参数值
          <Route path="/" exact render={(params) => <HOCRouter match={params} comp="Home" doctitle='首页' auth={false} mainpage={true} />} />
          <Route path="/gamble" exact render={(params) => <HOCRouter match={params} comp="Gamble" doctitle='竞猜' auth={false} mainpage={true} />} />
          <Route path="/login" exact render={(params) => <HOCRouter match={params} comp="Login" doctitle='登录' auth={true} />} />
          <Route path="/my" exact render={(params) => <HOCRouter match={params} comp="My" doctitle='我的' auth={false} mainpage={true} />} />
          <Route path="/registry" exact render={(params) => <HOCRouter match={params} comp="Registry" doctitle='注册' mainpage={true} />} />
          <Route path="/post/:postId" exact render={(params) => <HOCRouter match={params} comp="Post" doctitle='详情' />} />
          <Route path="/resetpassword" exact render={(params) => <HOCRouter match={params} comp="ResetPassword" doctitle='修改密码' />} />
          <Route path="/contribution" exact render={(params) => <HOCRouter match={params} comp="Contribution" doctitle='新建笔记' />} />
          <Route component={NotFound} mainpage={true} />
        </Switch>
      </HashRouter>
    )
  }
}

export default App;
